Skip to content

Xtensa: HIFI opt paths for add/sub/quantize/dequantize/strided_slice - #3642

Open
unmeshna017 wants to merge 2 commits into
tensorflow:mainfrom
unmeshna017:xtensa_inc_headers
Open

Xtensa: HIFI opt paths for add/sub/quantize/dequantize/strided_slice#3642
unmeshna017 wants to merge 2 commits into
tensorflow:mainfrom
unmeshna017:xtensa_inc_headers

Conversation

@unmeshna017

@unmeshna017 unmeshna017 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
  • Adds HIFI3/4/5 NNLib paths for add, sub, quantize, dequantize, strided_slice
  • Introduces the INCLUDE_FLOAT_OPT / FLOAT_OPT_FLAG build gating
  • Reference fallback on non-HIFI builds

BUG=NA
Adding @cad-audio and @joshih-cad for review

…ation

Move the explicit Xtensa kernel source list from xtensa_makefile.inc into
ext_libs/xtensa.inc and extend it with the split float/int reference kernels
(conv, depthwise_conv, fully_connected, pooling, reduce). Add a FLOAT_OPT_FLAG
build path and an INCLUDE_FLOAT_OPT gate driven by the core's VFPU capability.

- xtensa.h: gate INCLUDE_FLOAT_OPT on VFPU + FLOAT_OPT_FLAG, add HIFI_IQ to the
  nnlib include guard, and restore the hifimini/fixedpoint_utils.h include path.
- xtensa_makefile.inc: add XTENSA_INCLUDE_FLOAT_OPT / -DFLOAT_OPT_FLAG, map
  hifi3/3z/fusion_f1/hifi1 to -DHIFI4, and restructure the LSTM/DECODE sources.
- xtensa.inc: add hifi_iq target, HIFI_SIMD_WIDTH, NDSP includes, and FFT paths.
- xtensa_download.sh: apply per-arch NNLib patches (xa_nnlib_<arch>.patch) and
  switch the patch guard to a file-existence check.
- Restore hifimini svdf.cc and fully_connected.cc kernels.
Route ADD, SUB, QUANTIZE, DEQUANTIZE, and STRIDED_SLICE through the Xtensa
NNLib kernels on HIFI3/HIFI4/HIFI5 (and HIFI_IQ) targets, with reference
fallbacks preserved for all other configurations.

- add.cc / sub.cc: add INCLUDE_FLOAT_OPT float32 broadcast paths
  (xa_nn_elm_add/sub_broadcast_4D_f32xf32_f32) and int8/int16 quantized
  broadcast paths; sub.cc fixes the input2 broadcast offset (inp2_off) and
  changes EvalSub to return TfLiteStatus.
- quantize.cc: add xa_nn_elm_requantize_* fast paths for asym8s/asym16s
  outputs with reference fallbacks, and replace the unsupported-type error
  with EvalQuantizeReference.
- dequantize.cc: gate the int8/int16 xa_nn_elm_dequantize_*_f32 paths on
  INCLUDE_FLOAT_OPT (replacing the older HIFI_VFPU macro).
- strided_slice.cc: add int8/int32 HIFI paths alongside the existing int16
  path (xa_nn_strided_slice_int8/int16/int32).
@unmeshna017
unmeshna017 requested a review from a team as a code owner July 30, 2026 09:05
@rameshkunasi

Copy link
Copy Markdown
Contributor

@ddavis-2015 @veblush Please review this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants